import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login.vue'
import LoginRegist from '@/components/LoginRegist.vue'
import Home from '@/components/Home.vue'
import HomeUsers from '@/components/HomeUsers.vue'
import HomeMenus from '@/components/HomeMenus.vue'
import UserAdd from '@/components/UserAdd.vue'
import UserEdit from '@/components/UserEdit.vue'
import HomeOutlines from '@/components/HomeOutlines.vue'
import HomeClasses from '@/components/HomeClasses.vue'
import HomeItems from '@/components/HomeItems.vue'
import HomePapers from '@/components/HomePapers.vue'
import PaperAdd from '@/components/PaperAdd.vue'
import PaperEdit from '@/components/PaperEdit.vue'
import Publish from '@/components/Publish.vue'
import Analysis from '@/components/Analysis.vue'
import Personalcenter from '@/components/Personalcenter.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: { name: 'users' },
    },
    {
      path: '/home',
      name: 'home',
      redirect: { name: 'users' },
      component: Home,
      children: [
        {
          path: 'users',
          name: 'users',
          component: HomeUsers
        },
        {
          path: 'users/add',
          name: 'userAdd',
          component: UserAdd
        },
        {
          path: 'users/edit:id',
          name: 'userEdit',
          component: UserEdit,
          props:true
        },
        {
          path: 'menus',
          name: 'menus',
          component: HomeMenus
        },
        {
          path: 'outlines',
          name: 'outlines',
          component: HomeOutlines,
        },
        {
          path: 'classes',
          name: 'classes',
          component: HomeClasses,
        },
        {
          path: 'items',
          name: 'items',
          component: HomeItems,
        },
        {
          path: 'papers',
          name: 'papers',
          component: HomePapers,
        },
        {
          path: 'paperAdd',
          name: 'paperAdd',
          component: PaperAdd,
        },
        {
          path: 'paperEdit/:id',
          name: 'paperEdit',
          component: PaperEdit,
          props:true,
        },
        {
          path: 'analysis/:id',
          name: 'analysis',
          component: Analysis,
          props:true,
        },
        {
          path: 'personalcenter',
          name: 'personalcenter',
          component: Personalcenter,
        }
      ]
    }, {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/publish/:id',
      name: 'publish',
      component: Publish,
      props:true
    },
      {
        path: '/regist',
        name: 'regist',
        component: LoginRegist
      }
  ]
})
